package sessionbeans;


import javax.annotation.Resource;
import javax.ejb.EJBContext;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

import supportClass.LoginDTO;
import supportClass.UtenteDTO;
import traveldreamEJB.Login;
import traveldreamEJB.Utente;

/**
 * Session Bean implementation class GestoreRegistrazione
 */
@Stateless
public class RegistrazioneSB implements RegistrazioneSBLocal {


	@PersistenceContext
    private EntityManager em;
	
	@Resource
	private EJBContext context;
    /**
     * Default constructor. 
     */
    public RegistrazioneSB() {
        // TODO Auto-generated constructor stub
    }
    
    @Override
    public void creaUtente(UtenteDTO utenteDTO, LoginDTO loginDTO)
    {
    	Utente newUtente= new Utente(utenteDTO);
    	Login newLogin= new Login(loginDTO);
		em.persist(newUtente);
		em.persist(newLogin);
	}
    
    @Override
    public void add(UtenteDTO utenteDTO )
    {
    	em.persist(new Utente(utenteDTO));
    }
    
   

}
